package com.zxy.h2demo;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

/**
 * Hello world!
 */
public class App {
  public static void main(String[] a) throws Exception {
    Class.forName("org.h2.Driver");
//    Connection conn = DriverManager.getConnection("jdbc:h2:tcp://localhost/~/test", "admin", "admin");
    Connection conn = DriverManager.getConnection("jdbc:h2:file:~/test", "admin", "admin");
    // add application code here
    Statement stmt = conn.createStatement();
//    stmt.execute("source ./test.sql");
    ResultSet rs = stmt.executeQuery("SELECT * FROM TEST ");
    while (rs.next()) {
      System.out.println(rs.getString("id"));
    }
    conn.close();
  }
}
